package com.knowif.util.commonUtil;

import java.io.UnsupportedEncodingException;

public class FileDownloadUtil {

	public String getDownloadName(String agent, String downloadFilename)
			throws UnsupportedEncodingException {
		String downLoadName = "";
		if (null != agent && -1 != agent.indexOf("MSIE")) // IE
		{
			downLoadName = java.net.URLEncoder
					.encode(downloadFilename, "UTF-8");
		} else if (null != agent && -1 != agent.indexOf("Mozilla")) // Firefox
		{
			downLoadName = new String(downloadFilename.getBytes("UTF-8"),
					"iso-8859-1");
		} else {
			downLoadName = java.net.URLEncoder
					.encode(downloadFilename, "UTF-8");
		}
		return downLoadName;
	}
}